﻿using System;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Drawing;

namespace MyWebPart
{
    public partial class MyUserControl : System.Web.UI.UserControl
    {
        public SPWeb Web { get; set; }
        public string TextColor { get; set; }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(this.TextColor))
            {
                Color myColor = Color.FromName(this.TextColor);
                if (myColor != null)
                {
                    Panel1.Style.Add("color", myColor.Name);
                }
            }

            string currentUser = this.Web.CurrentUser.Name;
            Panel1.Controls.Add(new LiteralControl(String.Format("Hello {0}!", currentUser)));
        }
    }
}